<template>
  <div class="test">
    <van-nav-bar placeholder title="考试名称" fixed left-arrow> </van-nav-bar>
    <div class="test__content">
      <div class="test__process">
        <div class="test__header">
          <div class="test__num">
            <span>考试进度</span>
            <span>
              <label>{{ num }}</label
              >/{{ total }}
            </span>
          </div>
          <div class="test__time">
            <span>剩余时间</span>
            <label>12:22</label>
          </div>
        </div>
        <div class="test__jd">
          <van-progress
            :show-pivot="false"
            track-color="rgba(255,255,255,0.4)"
            stroke-width="6px"
            color="#fff"
            :percentage="percentage"
          />
        </div>
      </div>

      <div class="test__cont">
        <div class="test__tag">填空题</div>

        <div class="test__title">您是通过什么方式获取知识信息？</div>

        <div class="test__ct" v-if="false">
          <van-field
            v-model="message"
            rows="6"
            autosize
            type="textarea"
            placeholder="请输入内容"
          />
        </div>

        <div class="test__ct">
          <div class="topic is--check">
            <span>A.公众公众号公众号公众号公众号</span>
            <img class="dd ddtm" src="@/assets/images/ddtm.png" />
            <img class="dd dctm" src="@/assets/images/dctm.png" />
          </div>
          <div class="topic">
            <span>B.公众号</span>
            <img class="dd ddtm" src="@/assets/images/ddtm.png" />
            <img class="dd dctm" src="@/assets/images/dctm.png" />
          </div>
          <div class="topic is--error">
            <span>C.公众号</span>
            <img class="dd ddtm" src="@/assets/images/ddtm.png" />
            <img class="dd dctm" src="@/assets/images/dctm.png" />
          </div>
          <div class="topic">
            <span>A.公众号</span>
            <img class="dd ddtm" src="@/assets/images/ddtm.png" />
            <img class="dd dctm" src="@/assets/images/dctm.png" />
          </div>
        </div>

        <div class="test__answer">
          <div class="test__sheader">
            <div class="test__score">答案得分：<span>A</span></div>
            <div class="test__error">错误得分：<span>C</span></div>
          </div>

          <div class="test__d">
            参考答案：这是答案解析这是答案解析这是答案解是答案解析这是答案解析这是答案解析
          </div>
        </div>
      </div>
      <div class="test__xs">
        <div class="test__inner"></div>
      </div>

      <van-action-bar>
        <van-action-bar-icon text="答题卡">
          <template #icon>
            <img
              style="width: 20px; height: 20px"
              src="@/assets/images/sc.png"
            />
          </template>
        </van-action-bar-icon>
        <van-action-bar-button
          type="danger"
          color="linear-gradient(270deg, #1CA893 0%, #1BCD74 100%)"
          text="下一题"
        />
      </van-action-bar>
    </div>
  </div>
</template>
<script name="Test" setup>
import { ref, reactive, computed } from "vue";
const total = ref(25);
const num = ref(10);
const message = ref("");
const percentage = computed(() => {
  return (num.value / total.value) * 100;
});
</script>
<style lang="scss" scoped>
.test {
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  ::v-deep .van-nav-bar {
    background: #16bd81;
    .van-icon {
      color: #fff;
    }
  }
  ::v-deep .van-nav-bar__title {
    color: #fff;
  }
  &__content {
    padding: 8px 18px;
    background: linear-gradient(180deg, #16bd81 0%, #f1fffc 100%);
    flex: 1;
    box-sizing: border-box;
  }
  &__process {
  }
  &__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    color: #ffffff;
    line-height: 20px;
    label {
      font-weight: 500;
    }
    span {
      margin-right: 10px;
    }
  }
  &__cont {
    margin-top: 20px;
    background-color: #fff;
    padding: 20px 16px;
    border-radius: 8px;
    min-height: 478px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }
  &__jd {
    padding-top: 6px;
  }
  &__xs {
    padding: 0 10px;
  }
  &__inner {
    height: 18px;
    background-color: rgba(0, 208, 171, 0.16);
    border-radius: 0 0 8px 8px;
  }
  &__tag {
    width: 59px;
    height: 20px;
    background: #1890ff;
    border-radius: 4px;
    font-size: 12px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  &__title {
    padding: 10px 0;
    font-size: 14px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
    line-height: 20px;
  }
  &__answer {
    margin-top: auto;
    padding-bottom: 30px;
  }
  &__score {
    span {
      font-size: 20px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      color: #0dc678;
      line-height: 28px;
    }
  }
  &__error {
    span {
      font-size: 20px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      color: #ff1d3b;
      line-height: 28px;
    }
  }
  &__d {
    font-size: 14px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    color: #676b6b;
    line-height: 20px;
    text-align: justify;
  }
  &__sheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  &__ct {
    border-radius: 4px;
    overflow: hidden;
    ::v-deep .van-cell {
      background: #f4f4f4;
    }

    .topic {
      padding: 12px 16px;
      background: #f4f4f4;
      border-radius: 4px;
      font-size: 14px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      color: rgba(0, 0, 0, 0.85);
      line-height: 20px;
      margin-bottom: 10px;
      display: flex;
      align-items: center;

      span {
        flex: 1;
        padding-right: 12px;
      }
      .dd {
        width: 24px;
        height: 24px;
        display: none;
      }
      &.is--check {
        background: #e1fffa;
        .ddtm {
          display: block;
        }
      }
      &.is--error {
        background: rgba(255, 29, 59, 0.1);
        .dctm {
          display: block;
        }
      }
    }
  }
}
</style>
